#include <iostream>  
int main() {  
    int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};  
    int n = sizeof(arr) / sizeof(arr[0]);  
    int sum = 0;  
    for (int len = 1; len <= n; len += 2) {  
        for (int i = 0; i <= n - len; i++) {   
            for (int j = i; j < i + len; j++) {  
                sum += arr[j];  
            }  
        }  
    }  
    std::cout << "所有奇数长度子数组之和为：" << sum << std::endl;  
    return 0;  
}